chore: Simplify contract subscription indexes#863
Conversation
|
We're building your pull request over on Zeet. |
engine-cloud - engine-cloud-devWe're building your pull request over Zeet. We have provided links for Zeet apps linked to this github repo
|
| @@index([contractId, timestamp]) | ||
| @@index([contractId, blockNumber]) | ||
| @@id([chainId, blockNumber, transactionHash]) | ||
| @@index([timestamp, chainId, contractAddress]) |
There was a problem hiding this comment.
What is the query pattern?
I believe we always queried by chainId and contractAddress and sometimes with timestamp? If that's the case, timestamp should be at the right-most column?
| @@index([topic2]) | ||
| @@index([topic3]) | ||
| @@id([chainId, blockNumber, transactionHash, logIndex]) | ||
| @@index([timestamp, chainId, contractAddress]) |
There was a problem hiding this comment.
How are we querying the data? Did a quick scan, it seems like we don't always pass in a timestamp. In that case we'd probably want to start with chainId, contractAddress - then timestamp or blockNumber
|
This PR is stale because it has been open for 7 days with no activity. Remove stale label or comment or this PR will be closed in 3 days. |
Goal: make insert/deletes more performant
PR-Codex overview
This PR focuses on updating the primary keys and indexes for the
contract_event_logsandcontract_transaction_receiptsmodels in the Prisma schema, enhancing the database structure for better performance and data integrity.Detailed summary
contract_event_logsto includechainId,blockNumber,transactionHash, andlogIndex.contract_transaction_receiptsto includechainId,blockNumber, andtransactionHash.chainIdandcontractAddress.